<!-- include ajax form updater -->
<script language="JavaScript" type="text/javascript" src="{$INA.adminTemplate}javascript/controlPanel.js"></script>
<script language="JavaScript" type="text/javascript" src="{$INA.adminTemplate}javascript/users.js"></script>
<!-- end include ajax form updater -->

<div class="lCol">
    <h2>Recent Page Updates</h2>
    <table class="latest" cellspacing="0">
        <tbody>
        {foreach from=$pages item=page}
            <tr class="{cycle values="shade,noshade"}">
                <td class="icon">
                    {if $page.created == $page.modified}
                        <img alt="New Page" src="{$INA.adminTemplate}images/stat_new.gif" align="middle">
                    {else}
                        <img alt="Updated Page" src="{$INA.adminTemplate}images/stat_update.gif" align="middle">
                    {/if}
                </td>
                <td class="title">
                    <a class="messagelink" href="{$INA.admin}sitestructure/?action=edit&id={$page.id}">{$page.title}</a><a href="{$INA.root}{$page.url}" target="_blank" class="external">&nbsp;&nbsp;&nbsp;</a>
                    <p class="excerpt">
                      {$page.datatype} owned by <b>{$page.user}</b>
                      in 
                      <a href="javascript: loadTree({$page.folderid})" style="color: rgb(102, 102, 102);">{$page.folder}</a>,
                      {$page.modified|date_format:'%e %b, %Y %H:%M'|default:"n/a"}
                    </p>
                </td>
            </tr>
        {foreachelse}
            <tr class="shade">
                <td class="icon"><img alt="Not Available" src="{$INA.adminTemplate}images/stat_na.gif" align="middle"></td>
                <td class="title">
                    No Changes
                </td>
            </tr>
        {/foreach}
        </tbody>
    </table>
</div>

<div class="rCol">
    {* load the user data *}
    {load_user_data}
    
    <div id="personalData">
        <h2>Personal Data</h2>
        <div id="userData">
            <table cellpadding="2" cellspacing="2" width="99%">
                <TBODY>
                    <tr>
                        <td rowspan="5" width="100">
                            <div id="userPic">
                                No Picture
                            </div>
                        </td>
                        <td class="property">User:</td>
                        <td><span class="adminuser puser">{$smarty.session.admin.login}</span> in group <span class="group puser">{$smarty.session.admin.group}</span></td>
                    </tr>
                    <tr>
                        <td class="property">Full Name:</td>
                        <td><div id="userName" ondblclick="updateUserName({$user.id});">{$user.fullname}</div></td>
                    </tr>
                    <tr>
                        <td class="property">E-Mail:</td>
                        <td><div id="userMail" ondblclick="updateUserMail({$user.id});">{$user.email|default:'n/a'}</div></td>
                    </tr>
                    <tr>
                        <td class="property">Date Created:</td>
                        <td>{$user.created|date_format:'%e %b, %Y %H:%M'|default:"n/a"}</td>
                    </tr>
                    <tr>
                        <td colspan="2" class="options">
                            <a href="{$INA.this}" class="admin" id="changePass" onClick="return unhide('changePassForm',true);">Change Password</a>
                            <!-- | <a href="" class="admin">Change Picture</a> -->
                        </td>
                    </tr>
                </TBODY>
            </table>
            
            <!-- change pass form -->
            {if $smarty.get.confirmPassChange}
                <div id="confirm">
                    Successfuly changed password!
                </div>
            {/if}
            
            <div id="changePassForm" {if !$changePassErrors}style="display: none;"{/if}>
                <form name="adduser" method="post" action="{$INA.this}" onsubmit="disableButton('submitNewPassword','Please Wait')">
                    <table class="smallForm">
                    <tr><td>
                        <label for="pass1">New Password</label><br />
                        <input type="password" name="pass1" value="" id="pass1" class="textInput {if $changePassErrors.pass1 or $changePassErrors.pass2}error{/if}" maxlength="32" />
                        {if $changePassErrors.pass1}
                            <span class="errorMessage">Please pick a long enough password, a minimum of 4 characters is required!</span>
                        {/if}
                        
                    </td></tr><tr><td>
                        <label for="pass2">Confirm New Password</label><br />
                        <input type="password" name="pass2" value="" id="pass2" class="textInput {if $changePassErrors.pass2}error{/if}" maxlength="32" />
                        {if $changePassErrors.pass2}
                            <span class="errorMessage">The entered passwords don't match!</span>
                        {/if}
                        
                    </td></tr><tr><td>
                        <input type="submit" name="submitNewPassword" id="submitNewPassword" value="Change Password" class="submitInput" /> <a class="admin" href="{$INA.this}" onClick="return hide('changePassForm',true);">Cancel</a>
                    </td></tr></table>
                </form>
            </div>
            <!-- end change pass form -->
        </div>
    </div>
    
    {* load the stats *}
    {load_site_stats}
    <div id="siteStats">
        <h2>Overall Stats</h2>
        <table cellpadding="2" cellspacing="2">
            <TBODY>
                <tr>
                    <td class="property">Total Number of Pages in Solution:</td>
                    <td>{$stats.pages} ({$stats.publishedPages} published)</td>
                </tr>
                <tr>
                    <td class="property">Total Number of Folders in Solution:</td>
                    <td>{$stats.folders}</td>
                </tr>
                <tr>
                    <td class="property">Number of Solution Users:</td>
                    <td>{$stats.users} ({$stats.admins} admins)</td>
                </tr>
                <tr>
                    <td class="property">Solution Created:</td>
                    <td>{$stats.created|date_format:'%e %b, %Y %H:%M'|default:"n/a"}</td>
                </tr>
                <tr>
                    <td class="property">Most Recent Update:</td>
                    <td>{$stats.modified|date_format:'%e %b, %Y %H:%M'|default:"n/a"}</td>
                </tr>
            </TBODY>
        </table>
    </div>
</div>